package com.myl.generator.domain.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.io.Serializable;

/**
 * ITableInfo
 * author: myl <ixiaomu@qq.com> 2024/1/4
 * tips:
 */
@Data
@TableName("information_schema.tables")
public class ITableInfo {

    @TableId(type = IdType.NONE)
    private Long id;

    @JsonIgnore
    private String tableSchema;

    private String tableName;

    private String engine;

    private Long dataLength;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    private String createTime;


    private String tableComment;

    public void setTableSchema(String tableSchema){
        this.tableSchema = tableSchema;
    }

    // 表数据大小
    public String getDataLength() {
        return (dataLength / 1024) + "kb";
    }

}
